function removeSpaces(str) {
  return str.replace(/\s+/g, "");
}

let removeSpaces = (function () {
  var re = /\s+/g;
  return function (str) {
    return str.replace(re, "");
  };
})();
